// 引入axios请求
import request from '@/utils/request'
// 请求获取知识小册的数据
// export  const getKnowledge = ()=>request.get('api/knowledge')

// 获取所有的数据
export function getKnowledge(page = 1, pageSize = 8, options = {}) {
  return request({
    url: '/api/knowledge',
    params: {
      page,
      pageSize,
      ...options
    }
  })
}

// 删除数据
export function delKnowledge(id) {
  return request({
    url: `/api/knowledge/${id}`,
    method: 'delete'
  })
}

// export const delKnowledge=(id)=>request.delete(`/api/knowledge/${id}`)

// 新建知识小册页面
export function newKnowledge(content = {}) {
  return request({
    url: 'api/knowledge/book',
    method: 'post',
    data: {
      ...content
    }
  })
}

// 编辑知识小册页面
export function editorKnowledge(id) {
  return request({
    url: `api/knowledge/${id}`
  })
}

// 回显知识小册的页面后,修改数据
// 发布 上线
export function showKnowledge(data) {
  return request({
    url: `api/knowledge/${data.id}`,
    method: 'patch',
    data
  })
}
